/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

using GMPBufferType from "gmp-video-codec.h";
using GMPAudioCodecType from "gmp-audio-codec.h";
using GMPMediaKeyStatus from "gmp-decryption.h";

namespace mozilla {
namespace gmp {

struct GMPDecryptionData {
  uint8_t[] mKeyId;
  uint8_t[] mIV;
  uint16_t[] mClearBytes;
  uint32_t[] mCipherBytes;
  nsCString[] mSessionIds;
};

struct GMPVideoEncodedFrameData
{
  uint32_t mEncodedWidth;
  uint32_t mEncodedHeight;
  uint64_t mTimestamp; // microseconds
  uint64_t mDuration; // microseconds
  uint32_t mFrameType;
  uint32_t mSize;
  GMPBufferType mBufferType;
  Shmem mBuffer;
  bool mCompleteFrame;
  GMPDecryptionData mDecryptionData;
};

struct GMPPlaneData
{
  int32_t mSize;
  int32_t mStride;
  Shmem mBuffer;
};

struct GMPVideoi420FrameData
{
  GMPPlaneData mYPlane;
  GMPPlaneData mUPlane;
  GMPPlaneData mVPlane;
  int32_t mWidth;
  int32_t mHeight;
  uint64_t mTimestamp; // microseconds
  uint64_t mDuration; // microseconds
};

struct GMPAudioCodecData
{
  GMPAudioCodecType mCodecType;
  uint32_t mChannelCount;
  uint32_t mBitsPerChannel;
  uint32_t mSamplesPerSecond;

  uint8_t[] mExtraData;
};

struct GMPAudioEncodedSampleData
{
  uint8_t[] mData;
  uint64_t mTimeStamp; // microseconds.
  GMPDecryptionData mDecryptionData;
  uint32_t mChannelCount;
  uint32_t mSamplesPerSecond;
};

struct GMPAudioDecodedSampleData
{
  int16_t[] mData;
  uint64_t mTimeStamp; // microseconds.
  uint32_t mChannelCount;
  uint32_t mSamplesPerSecond;
};

struct GMPKeyInformation {
  uint8_t[] keyId;
  GMPMediaKeyStatus status;
};

}
}
